package com.puzzlebazar.client.heyawake;

import com.puzzlebazar.client.main.control.GenericController;
import com.puzzlebazar.client.puzzle.control.PuzzleController;
import com.puzzlebazar.client.puzzle.model.GenreFactory;
import com.puzzlebazar.client.puzzle.model.History;
import com.puzzlebazar.client.puzzle.model.MoveTimer;
import com.puzzlebazar.client.puzzle.model.PuzzleFactory;
import com.puzzlebazar.client.puzzle.model.PuzzleModel;
import com.puzzlebazar.client.puzzle.view.ExtPuzzleView;
import com.puzzlebazar.client.squaregrid.view.SGViewImpl;
import com.puzzlebazar.client.util.BoundInfo;
import com.puzzlebazar.client.util.Vec2i;

public class HeyawakeFactory implements PuzzleFactory {

	private static HeyawakeFactory singleton = null;
	
	public static HeyawakeFactory get() {
		if( singleton == null )
			singleton = new HeyawakeFactory();
		return singleton;
	}
	
	public static void register( GenreFactory genreFactory ) {
		genreFactory.registerFactory( "Heyawake", get() );		
	}
	
	@Override
	public PuzzleModel newModel() throws Exception {

		HeyawakeModel model = new HeyawakeModel();
		return model;
	}

	@Override
	public SGViewImpl createView(PuzzleModel model) throws Exception {		
		return new HeyawakeView((HeyawakeModel)model, new Vec2i(300, 300), 3);
	}

	@Override
	public PuzzleController createController(PuzzleModel model,
			History history, MoveTimer moveTimer, ExtPuzzleView view,
			GenericController parentController) throws Exception {
		return new HeyawakeController((HeyawakeModel)model, history, moveTimer, view, parentController);
	}

	@Override
	public BoundInfo getBoundInfo() {
		return HeyawakeModel.boundInfo;
	}
	
	@Override
	public Vec2i getDefaultSize() {
		return HeyawakeModel.defaultSize;
	}


}
